{% include "../header.html" %}
{% include "left.html" %}
<script type="text/javascript" charset="utf-8" src="/static/ueditor/editor_config.js"></script>
<script type="text/javascript" charset="utf-8" src="/static/ueditor/editor_all.js"></script>
<form method="post" onsubmit="return addblog(this);">
	<table>
		<tr>
			<td>标题</td>
			<td>
				<input type="text" size="50" name="btitle" id="btitle"/>
				分类：
				<select name="category">
					<option value="">其他</option>
					{%for item in results %}
					<option value="{{item.key}}">{{item.cname}}</option>
					{%endfor%}
				</select>
			</td>
		</tr>
		<tr>
			<td>内容</td>
			<td>
				<div id="editor" name="bbody">
				
				</div>
				<input type="hidden" name="desc" id="bdesc"/>
			</td>
		</tr>
		<tr>
			<td></td>
			<td><input type="submit" /></td>
		</tr>
	</table>
</form>
</div>
</div>
<script>
	$(document).ready(function(){
		var editor = new UE.ui.Editor();
		editor.render('editor');
	});
	function addblog(form){
		if($("#btitle").val() == ""){
			alsert("请填写日志名称");
			return false;
		}else if(!UE.getEditor('editor').hasContents()){
			alsert("请填写日志内容");
			return false;
		}else{
			$("#bdesc").val(UE.getEditor('editor').getContentTxt().replace(/(\d)+/,""));
			return true;
		}
	}
</script>
{% include "../footer.html" %}
